/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.aptech.entities;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author Winner
 */
@Entity
@Table(name = "tblElevationType")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "TblElevationType.findAll", query = "SELECT t FROM TblElevationType t"),
    @NamedQuery(name = "TblElevationType.findByEtID", query = "SELECT t FROM TblElevationType t WHERE t.etID = :etID"),
    @NamedQuery(name = "TblElevationType.findByEtName", query = "SELECT t FROM TblElevationType t WHERE t.etName = :etName"),
    @NamedQuery(name = "TblElevationType.findByEtDescription", query = "SELECT t FROM TblElevationType t WHERE t.etDescription = :etDescription"),
    @NamedQuery(name = "TblElevationType.findByEtStatus", query = "SELECT t FROM TblElevationType t WHERE t.etStatus = :etStatus")})
public class TblElevationType implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "etID")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer etID;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 20)
    @Column(name = "etName")
    private String etName;
    @Size(max = 200)
    @Column(name = "etDescription")
    private String etDescription;
    @Column(name = "etStatus")
    private boolean etStatus;
    @OneToMany(mappedBy = "etID")
    private List<TblElevation> tblElevationList;
//Nhớ phải có @XmlTransient
    @XmlTransient
    public List<TblElevation> getTblElevationList() {
        return tblElevationList;
    }

    public void setTblElevationList(List<TblElevation> tblElevationList) {
        this.tblElevationList = tblElevationList;
    }

    public TblElevationType() {
    }

    public TblElevationType(Integer etID) {
        this.etID = etID;
    }

    public TblElevationType(Integer etID, String etName) {
        this.etID = etID;
        this.etName = etName;
    }

    public Integer getEtID() {
        return etID;
    }

    public void setEtID(Integer etID) {
        this.etID = etID;
    }

    public String getEtName() {
        return etName;
    }

    public void setEtName(String etName) {
        this.etName = etName;
    }

    public String getEtDescription() {
        return etDescription;
    }

    public void setEtDescription(String etDescription) {
        this.etDescription = etDescription;
    }

    public boolean getEtStatus() {
        return etStatus;
    }

    public void setEtStatus(boolean etStatus) {
        this.etStatus = etStatus;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (etID != null ? etID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof TblElevationType)) {
            return false;
        }
        TblElevationType other = (TblElevationType) object;
        if ((this.etID == null && other.etID != null) || (this.etID != null && !this.etID.equals(other.etID))) {
            return false;
        }
        return true;
    }
//Thằng này lấy ra dữ liệu khi gọi hàm getItemsAvailableSelectOne
    @Override
    public String toString() {
        //return "com.aptech.entities.TblElevationType[ etID=" + etID + " ]";
        return etName;
    }
    
}
